package com.yh.mapper;

import com.yh.javabean.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select("select * from product")
    List<Product> selectAll();

    @Insert("insert into product (productNum,productName,cityName,departureTime,productPrice,productDesc,productStatus) values(#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    int insert(Product product);
    //根据id查询
    @Select("select * from product where id=#{id}")
    Product selectById(int id);
    //修改
    @Update("update product set productNum=#{productNum},productName=#{productName},cityName=#{cityName},departureTime=#{departureTime},productPrice=#{productPrice},productDesc=#{productDesc},productStatus=#{productStatus} where id=#{id}")
    int update(Product product);

    @Delete("delete from product where id=#{id}")
    int deleteById(int id);




}
